<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
 CalenderUI();
 link_js(array('jquery.fixedheader','bootstrap-typeahead'),'asset/js/');
 ?>
<!--<div class='container'>-->
     <div class="tabbable"> <!-- Only required for left/right tabs -->
	<?=$tab_header;?>
       <div class="tab-content" style=''>
	   <br>
            <div class="tab-pane" id="table1"></div>
            <div class="tab-pane active" id="table2"><?=$this->zetro_auth->allAuth($frm3,'approval_pinjaman');?><?=$this->zetro_auth->allAuth($list,'approval_pinjaman');?></div></div>
       </div>
		<input type='hidden' id='row_aktif' value='<?=empty($_GET['ot'])?'n':$_GET['ot'];?>'/>
		<input type='hidden' id='rows' value='<?=base64_decode($this->session->userdata('menus'));?>'/>
    </div>
<!--</div>-->
<?=$modal;?>
<script language='javascript'>
$(document).ready(function(e) {
	$('div.tab-content').css('height',(screen.availHeight-275));
	$('#bln').html("<?=$bln;?>").change(function(){_show_data('1');});
	$('#thn').html("<?=$thn;?>").change(function(){_show_data('1');});
	$('#id_lokasi').html("<?=$lok2;?>").change(function(){_show_data('1');});
	$('#c_cari').click(function(){_show_data('1');});
	_show_data('');
})

function _show_data(tp)
{
	show_indicator('NewList',9);
	$.post('getlistpinjaman',$('#frm1').serialize()+'&ot='+$('#row_aktif').val(),function(result)
	{
		$('#NewList tbody').html(result);
		(tp=='')?
		$('#NewList').fixedHeader({'width':(screen.availWidth-50),'height':(screen.availHeight-370)}):'';
	})
}
function btn_click(id,aksi)
{
	switch(aksi)
	{
		case 'process':
		break;
		case 'detail':
		_show_popup(id);
		break;
		case 'show':
		break;
		case 'deleted':
		jConfirm('Yakin pinjaman ini akan dibatalkan?','Ziebar Alert',function(r)
		{
			if(r)
			{
				$.post('deletepinbar',{'id':id},function(rst){ _show_data('1');})
			}
		})
		break;
		case 'appr':
		var idd=id.split(':');
		jConfirm('Apakah anda yakin akan menyetujui pinjaman ini?','Alert',function(r){
			if(r)
			{
				$.post('update_approval',{'id':idd[0],'lvl':idd[1]},
				function(result)
				{
					$('#myModal').modal('hide');
					_show_data('id_reg');
				})
			}
		})
		break;
		case 'noappr':
		var idd=id.split(':');
		jPrompt('Silahkan masukan alasan tidak menyetujui pendaftaran ini','Alasan','Alert',function(r){
			if(r)
			{
				$.post('deleted_register',{'id':idd[0],'lvl':idd[1],'rsn':r},
				function(result)
				{
					$('#myModal').modal('hide');
					_show_data('id_reg');
				})
			}
		})
		break;
	}
}
function _show_popup(id)
{
	$.post('realisasi_approve',{'id':id},function(result){
	 $('.modal-body').css('overflow','hidden').html(result);
	 $('#myModal').modal('show');	
	})
}

</script>